package com.gxa.saas.portal.service.hhyservice.impl;

import com.gxa.saas.core.entity.vo.hhy.MonthVO;
import com.gxa.saas.core.entity.vo.hhy.UserInfoVO;
import com.gxa.saas.portal.mapper.hhy.ShopUserMapper;
import com.gxa.saas.portal.service.hhyservice.ShopUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class ShopUserServiceImpl implements ShopUserService {

    @Autowired
    private ShopUserMapper shopUserMapper;

    @Override
    public List<MonthVO> getNewUser(Integer shopid) {
        List<MonthVO> list = new ArrayList<>();
        MonthVO monthVO = new MonthVO();

//        DateTime dateTime = new DateTime();
//        DateTime lastMonth = dateTime.minusMonths(1);

        monthVO.setThisMonth(shopUserMapper.thisMothNewUser(shopid));
        monthVO.setLastMonth(shopUserMapper.lastMothNewUser(shopid));
        list.add(monthVO);
        return list;
    }

    @Override
    public List<MonthVO> getTotalVisit(Integer shopid) {
        List<MonthVO> list = new ArrayList<>();
        MonthVO monthVO = new MonthVO();

//        DateTime dateTime = new DateTime();
//        DateTime lastMonth = dateTime.minusMonths(1);

        monthVO.setThisMonth(shopUserMapper.thisMothTotalVisit(shopid));
        monthVO.setLastMonth(shopUserMapper.lastMothTotalVisit(shopid));
        list.add(monthVO);
        return list;
    }

    @Override
    public List<MonthVO> getAllOrder(Integer shopid) {
        List<MonthVO> list = new ArrayList<>();
        MonthVO monthVO = new MonthVO();

//        DateTime dateTime = new DateTime();
//        DateTime lastMonth = dateTime.minusMonths(1);

        monthVO.setThisMonth(shopUserMapper.thisMothAllOrder(shopid));
        monthVO.setLastMonth(shopUserMapper.lastMothAllOrder(shopid));
        list.add(monthVO);
        return list;
    }

    @Override
    public List<UserInfoVO> getUserInfo(Integer shopid) {
        List<UserInfoVO> list =  this.shopUserMapper.getUserInfo(shopid);
        return list;
    }
}
